import os, threading

class apiGoThread(threading.Thread):  # 继承父类threading.Thread
    def __init__(self,ip, port, user, passwd, size, timeout, apiport, outport ):
        threading.Thread.__init__(self)
        self.ip = ip
        self.port = port
        self.user = user
        self.passwd = passwd
        self.size = size
        self.timeout = timeout
        self.apiport = apiport
        self.outport = outport

    def run(self):  # 把要执行的代码写到run函数里面 线程在创建后会直接运行run函数
        # python解释器绝对路径(读取事先设置好的python家目录)
        JainaPython = os.getenv('JainaPython').replace('\\', '\\\\')
        JainaPython = JainaPython + "python.exe"
        os.system(
            JainaPython + " .\\socket\\sshSendCmdAPI.py -l " + self.ip + " -P " + self.port + " -u " + self.user + " -p " + self.passwd + " -s " + self.size + " -t " + self.timeout + " -i " + self.apiport + " -o " + self.outport)
